<?php

namespace app\cps\validate;

use think\Validate;
use app\common\Error;

class OfficialAccount extends Validate
{
    protected $rule = [
        'id' => 'require',
        'type' => 'require',
        'is_auth' => 'require',
        'original_id' => 'require',
        'wechat_number' => 'require',
        'name' => 'require',
        'app_id' => 'require',
        'app_secret' => 'require',
        'content' => 'require',
        'link_url' => 'require',

        'keyword' => 'require',
        'link_type' => 'require',
        // 'video_id' => 'require',
        'title' => 'require',
        'value' => 'require',

        'is_push' => 'require',
        'pid' => 'require',
    ];

    protected $message = [
        'id.require' => Error::ID_NOT_EXIXTS,
        'type.require' => Error::TYPE_NOT_EXIXTS,
        'is_auth.require' => Error::IS_AUTH_NOT_EXIXTS,
        'original_id.require' => Error::ORIGINAL_ID_NOT_EXIXTS,
        'wechat_number.require' => Error::WECHAT_NUMBER_NOT_EXIXTS,
        'name.require' => Error::NAME_NOT_EXIXTS,
        'app_id.require' => Error::APP_ID_NOT_EXIXTS,
        'app_secret.require' => Error::APP_SECRET_NOT_EXIXTS,
        'content.require' => Error::CONTENT_NOT_EXIXTS,
        'link_url.require' => Error::LINK_URL_NOT_EXIXTS,

        'keyword.require' => Error::KEYWORD_NOT_EXIXTS,
        'link_type.require' => Error::LINK_TYPE_NOT_EXIXTS,
        // 'video_id.require' => Error::VIDEO_ID_NOT_EXIXTS,
        'title.require' => Error::TITLE_NOT_EXIXTS,
        'value.require' => Error::VALUE_NOT_EXIXTS,

        'is_push.require' => Error::IS_PUSH_NOT_EXIXTS,
        'pid.require' => Error::PID_NOT_EXIXTS,
    ];

    protected $scene = [
        'edit' => ['id', 'type', 'is_auth', 'original_id', 'wechat_number', 'name', 'app_id', 'app_secret'],
        'follow_reply' => ['title', 'link_url'],
        'sign_reply' => ['title', 'link_url'],
        'add_keyword' => ['keyword', 'type', 'link_type', 'title'],
        'edit_keyword' => ['id', 'keyword', 'type', 'link_type', 'title'],
        'detail' => ['id'],
        'order_list' => ['id'],
        'switch' => ['type', 'value'],
        'menu_setting' => ['content', 'is_push'],
    ];
}